package cs2114.alarmclock;

import android.provider.ContactsContract.CommonDataKinds.Photo;

// -------------------------------------------------------------------------
/**
 *  Holds the logic for cycling through photos.
 *
 *  @author Joe Acanfora
 *  @version Nov 16, 2011
 */
public class PhotoLogic
{
    private Deque<Photo> circle;

    /**
     * Constructor that initalizes variables.
     */
    public PhotoLogic()
    {
        circle = new Deque<Photo>();
    }
    /**
     * Adds a photo to the list.
     * @param pic  picture to be added.
     */
    public void addPhoto(Photo pic)
    {
        circle.enqueueAtFront(pic);
    }
    /**
     * Removes the current photo from the list.
     * @return the next Photo.
     */
    public Photo removePhoto()
    {
        circle.dequeueAtFront();
        return circle.peek();
    }
    /**
     * Pulls up the next picture in the list.
     * @return the next photo.
     */
    public Photo cyclePhoto()
    {
        // move the front picture to the back.
        circle.enqueueAtRear(circle.dequeueAtFront());
        // peek the next pic.
        return circle.peek();
    }

}
